//
//  CarView.m
//  Zhiche-Carriage
//
//  Created by LeeBruce on 16/7/15.
//  Copyright © 2016年 LeeBruce. All rights reserved.
//

#import "CarView.h"

@implementation CarView

-(id)initWithFrame:(CGRect)frame andInteger:(NSInteger)integer
{
    if (self = [super init]) {
        
        self.frame = frame;
        self.backgroundColor = GrayColor;
        NSArray *imageArray = @[@"step_driver ",@"step_driver_pre ",@"step_car ",@"step_car_pre ",@"step_ok ",@"step_ok_pre "];
        
        NSArray *titleArray = @[@"个人信息",@"证件信息",@"完成"];
        
        for (int i = 0; i < titleArray.count; i ++) {
            
            UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectMake((screenWidth - 90 - 182 * kWidth)/2.0 + (30 + 91 * kWidth) * i, 16, 30, 30)];
            imageV.layer.cornerRadius = 10;
            imageV.layer.masksToBounds = YES;
            
            if (i + 1 <= integer) {
                imageV.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageArray[2 * (i + 1) - 1]]]  ;
                
            } else {
            
             imageV.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageArray[2 * i]]]  ;
            }
            
            
            
            UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMidX(imageV.frame) - 40 , CGRectGetMaxY(imageV.frame) + 4, 80, 30)];
            titleLabel.text = titleArray[i];
            titleLabel.font = Font(12);
            titleLabel.textAlignment = NSTextAlignmentCenter;
            
            if (i + 1 <= integer) {
                titleLabel.textColor = YellowColor;
            } else {
                
                titleLabel.textColor = Color_RGB(156, 156, 156, 1);

            }
            
            
            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(imageV.frame) + 3 * kWidth, CGRectGetMidY(imageV.frame), 85 * kWidth, 0.5)];
            img.image = [UIImage imageNamed:@"dashed"];
            
          
//            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(imageV.frame) + 3 * kWidth, CGRectGetMidY(imageV.frame), 85 * kWidth, 0.5)];
//            
//            if (i < integer - 1) {
//                label.backgroundColor = YellowColor;
//            } else {
//                label.backgroundColor = Color_RGB(156, 156, 156, 1);
// 
//            }
            
            [self addSubview:imageV];
            [self addSubview:titleLabel];
            
            if (i !=titleArray.count - 1) {
//                [self addSubview:label];
                
                [self addSubview:img];

            }
            
            
        }
        
    }
    
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
